home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / std / c++ / 1133 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  2.2 KB

  1. Path: engnews1.Eng.Sun.COM!taumet!clamage
  2. From: "nicolas (n.) chapados" <chapados@bnr.ca>
  3. Newsgroups: comp.std.c++
  4. Subject: Re: Better template syntax?
  5. Date: 17 Apr 1996 14:57:57 GMT
  6. Organization: Bell Northern Research
  7. Approved: clamage@eng.sun.com (comp.std.c++)
  8. Message-ID: <317433DA.72BE@bnr.ca>
  9. References: <31741E6C.53CA@cs.tu-berlin.de>
  10. NNTP-Posting-Host: taumet.eng.sun.com
  11. Mime-Version: 1.0
  12. Content-Type: text/plain; charset="us-ascii"
  13. Content-Transfer-Encoding: 7bit
  14. X-Nntp-Posting-Host: bmtlh567.bnr.ca 
  15. X-Mailer: Mozilla 2.01 (X11; I; HP-UX A.09.05 9000/712) 
  16. X-Lines: 32
  17. Content-Length: 1223
  18. Originator: clamage@taumet
  19.  
  20. Roman Lechtchinsky wrote:
  21.  
  22. > Now, personally I would prefer to write something like:
  23. > template<class T { bool operator==( const T& t ) const; }> ...
  24. > Now, what I'd like to know is if something like this has been considered and
  25. > rejected ( and why ) and what other people think about it ( would this be
  26. > really easier to use in practice; do you consider it more elegant than the
  27. > current approach ). Thanks in advance.
  28.  
  29. Specification of requirements on template arguments in a form similar to
  30. what
  31. you suggest is discussed in Stroustrup's Design and Evolution of C++.
  32. The
  33. reasons leading to the rejection of similar proposals are discussed as
  34. well
  35. (although not to my satisfaction, since one of the stated reasons is
  36. that 
  37. requirements specification can be "emulated" in the language--this was
  38. true
  39. when Stroustrup wrote D&E but is not true any more.)
  40.  
  41. Note that your and similar approach make it easy to specify positive
  42. requirements on arguments ("this type shall have this and that") but not
  43. negative
  44. requirements ("this type shall *not* have this and that").
  45.  
  46. ---
  47. Nicolas Chapados                          ----Standard Disclaimer---- 
  48. chapados@nortel.ca                        Nortel Technology, formerly
  49. BNR
  50.  
  51.  
  52. [ comp.std.c++ is moderated.  To submit articles: try just posting with      ]
  53. [ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu         ]
  54. [ FAQ:      http://reality.sgi.com/employees/austern_mti/std-c++/faq.html    ]
  55. [ Policy:   http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ]
  56. [ Comments? mailto:std-c++-request@ncar.ucar.edu                             ]
  57.